﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for StatisticData
/// </summary>
public class StatisticData
{
	public StatisticData()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public bool Insert(StatisticEntities item)
    {
        string[] paras = { "@visited", "@today" };
        string[] values = { item._visited.ToString(), item._today };
        if (Database.getExecProcedure("sp_InsertStatistics", paras, values) > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public bool Update(StatisticEntities item)
    {
        string[] paras = { "@visited", "@today" };
        string[] values = { item._visited.ToString(), item._today };
        if (Database.getExecProcedure("sp_UpdateStatistics", paras, values) > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    public System.Data.SqlClient.SqlDataReader getAll()
    {
        return Database.getReader("exec sp_GetStatistics");
    }

}
